package com.study.compose.beta.activity.coroutines

import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData
import com.module.compose.base.net.API
import com.module.compose.base.viewModel.OurViewModel
import com.study.compose.beta.api.BlogApi
import com.study.compose.beta.entity.BlogListData

class CoroutinesViewModel : OurViewModel() {

    @API
    private lateinit var api: BlogApi

    /**
     * 请求数据
     */
    private val _blogListLiveData: MutableLiveData<BlogListData> = MutableLiveData()
    val blogListLiveData: LiveData<BlogListData> = _blogListLiveData

    /**
     * 获取数据
     */
    fun getBlogList() {
        verify(suc = { _blogListLiveData.value = it }) {
            api.blogList()
        }
    }
}